package pl.makimo.fuzzy.linguistics;

import pl.makimo.fuzzy.sets.CrispSet;
import pl.makimo.fuzzy.sets.DiscreteFuzzySet;
import pl.makimo.fuzzy.sets.FuzzySet;
import pl.makimo.fuzzy.sets.Type2DiscreteFuzzySet;

public class DiscreteLinguisticVariable<T> extends LinguisticVariable<T> {
	public CrispSet<T> data;
	
	public DiscreteLinguisticVariable(String name, CrispSet<T> data) {
		this.data = data;
		this.name = name;
	}

	public void add(String label, FuzzySet<T> set) {
		if (set instanceof DiscreteFuzzySet) {
			((DiscreteFuzzySet<T>)set).elements = data;	
		} else if (set instanceof Type2DiscreteFuzzySet) {
			((Type2DiscreteFuzzySet<T>)set).elements = data;
		}
		
		set.column = name;
		labels.put(label, set);
	}
}
